//
// Created by win10 on 2024/12/31.
//
#include <stdio.h>
#include <stdlib.h>
typedef char ElemType;
typedef  struct  BiNode
{  ElemType  data;
    struct  BiNode   *lchild,*rchild;
}BiNode,*BiTree;

BiNode* createBiTree() {
    char ch;
    scanf("%c",&ch);
    if(ch=='#') {
        return NULL;
    }
    BiNode* newNode = (BiNode*)malloc(sizeof(BiNode));
    newNode->data = ch;
    newNode->lchild = createBiTree();
    newNode->rchild = createBiTree();
    return newNode;
}

void preorderTraversal(BiTree root) {
    if(root==NULL) return;
    preorderTraversal(root->lchild);
    printf("%c",root->data);
    preorderTraversal(root->rchild);
}

int main() {
    BiTree t;
    t = createBiTree();
    preorderTraversal(t);
    return 0;
}